package com.sixteen.ordering_system.common;

import org.springframework.boot.web.server.ErrorPage;
import org.springframework.boot.web.server.ErrorPageRegistrar;
import org.springframework.boot.web.server.ErrorPageRegistry;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;

@Component
public class ErrorConfig implements ErrorPageRegistrar {

    @Override
    public void registerErrorPages(ErrorPageRegistry registry) {
        ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/erropage");
        ErrorPage error402Page = new ErrorPage(HttpStatus.UNAUTHORIZED, "/erropage");
        ErrorPage error500Page = new ErrorPage(HttpStatus.MULTI_STATUS, "/erropage");
        registry.addErrorPages(error404Page,error402Page,error500Page);
    }
}